// Last Update:2015-01-28 10:58:03
/**
 * @file sscanf.c
 * @brief 
 * @author 
 * @version 0.1.00
 * @date 2015-01-28
 */

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

int main(int argc, char *argv[])
{
    uint8_t mac[6] = {0};
    const char *str = "D0-50:99:42:9D:5D";

    sscanf(str, "%02x%*[:-]%02x%*[:-]%02x%*[:-]%02x%*[:-]%02x%*[:-]%02x",
            (unsigned int *)&mac[0], (unsigned int *)&mac[1], (unsigned int *)&mac[2],
            (unsigned int *)&mac[3], (unsigned int *)&mac[4], (unsigned int *)&mac[5]);
    int i;
    for (i = 0; i < 6; i++)
    {
        printf("%02x ", mac[i]);
    }
    printf("\n");

    return 0;
}
